package com.song.cloud.seata.controller;

import com.song.cloud.common.entities.CommonResult;
import com.song.cloud.seata.service.accountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @Author ZhangGuisong
 * @Date 2021/3/4-22:33
 */
@RestController
public class accountController {
    @Autowired
    private accountService accountService;
    @PostMapping("/account/decreateAccont")
    public CommonResult decreateAccont(@RequestParam("user_id")Long user_id, @RequestParam("money") BigDecimal money) {
        accountService.decreateAccount(user_id,money);
        return new CommonResult(200,"账户中已经减去"+money,"good");
    }
}
